import java.io.*;

public class mySocket {
    public static void main(String[] args) throws IOException {
        IoContext.createContext(mySocket.class.getProtectionDomain().getCodeSource().getLocation().getPath());
        TCPServer tcpServer = new TCPServer(IoContext.getIp().equals(".") ? null : IoContext.getIp()
                , IoContext.getPort());

        if (!tcpServer.start()) {
            System.out.println("TCPServer 启动失败!");
            return;
        }
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String str;
        do {
            str = bufferedReader.readLine();
            if (str == null || str.equals("exit")) {
                break;
            }
            if (str.length() == 0) {
                continue;
            }
            // 发送字符串
//            tcpServer.broadCast(str);
        } while (true);
        tcpServer.stop();
        IoContext.exit();

    }
}
